﻿﻿using System;
using StarTrek.Ship;
using StarTrek.World;

namespace StarTrek.Weapon
{
    public enum ShipAlertStatus
    {
        None,
        Green,
        Yellow,
        Red
        //Lundicrious;
    }
    class AlertStatus : iWeapon
    {
        private ShipAlertStatus status = ShipAlertStatus.None;
        private bool damaged;
        private iShip parent;

        public ShipAlertStatus Status
        {
            get { return status; }
            set { status = value; }
        }

        #region iWepon Members

        public ShipStatus ApplyWeponToShip(iShip Target, float Energy)
        {
            throw new InvalidWeaponException(this, Target);
        }

        public iShip ApplyDefenseToShip(float Energy)
        {
            //What does the different status do to a ship?
            return this.parent;
        }

        public bool isFunctional
        {
            get { return !damaged; }
            set { damaged = !value; }
        }

        public iShip Parent
        {
            get { return parent; }
            set { parent = value; }
        }
        public string WeaponReport()
        {
            string rVal = "Ship is currently not at alert status";
            
            if (status != ShipAlertStatus.None)
                rVal =  string.Format("Ship is currently at {0} Alert Status", status);
            
            return rVal;
        }
        #endregion

        #region iWeapon Members


        public void Load(System.Xml.XmlNode node)
        {
            //What is there to load from the node?  nothing.
        }

        public bool isOffensive{get { return false;}}

        public bool NeedsEnegery { get { return true; } }

        public string Name
        {
            get { return "Alert"; }
        }

        #endregion
    }
}
